class Animal{
    age:number
    constructor(age:number){
        this.age= age;
    }
    eat(){
        console.log('吃鸡腿');
    }
}

class Dog extends Animal{
    type:string
    constructor(type:string,age:number){
        super(age) //记得加super
        this.type =type
    }
    // 同JS原生class一样会覆盖父类的eat方法
    eat(){
        console.log('狗class中的eat');
    }
}

let dog = new Dog('边境牧羊犬',3);
dog.eat()
